FROM python:3.6.9

# 镜像作者Pony
MAINTAINER Pony


# 修改apt源
## 针对ubuntu发行版本
RUN sed -i s@/archive.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list
## 针对debian发行版本
RUN sed -i s@/deb.debian.org/@/mirrors.aliyun.com/@g /etc/apt/sources.list
RUN apt-get clean
RUN apt-get update



# 设置 python 环境变量
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

# 可选：设置镜像源为国内
RUN mkdir /root/.pip
COPY pip.conf /root/.pip
COPY t1.py /root/
COPY requirements.txt /root/
COPY start.sh /root/


# 更新pip版本
RUN /usr/local/bin/python -m pip install --upgrade pip

# 安装项目依赖
RUN pip install -r /root/requirements.txt

# 移除\r in windows
RUN sed -i 's/\r//' /root/start.sh

# 给start.sh可执行权限
RUN chmod +x /root/start.sh

RUN apt-get install net-tools

RUN apt-get install lsof


# 数据迁移，并使用uwsgi启动服务
ENTRYPOINT /bin/bash /root/start.sh
